package com.ctibook.booksystem.model.bookcatalog;
import java.util.Date;

import org.apache.solr.analysis.HTMLStripCharFilterFactory;
import org.apache.solr.analysis.LowerCaseFilterFactory;
import org.apache.solr.analysis.StopFilterFactory;
import org.hibernate.search.annotations.Analyze;
import org.hibernate.search.annotations.Analyzer;
import org.hibernate.search.annotations.AnalyzerDef;
import org.hibernate.search.annotations.Boost;
import org.hibernate.search.annotations.CharFilterDef;
import org.hibernate.search.annotations.DateBridge;
import org.hibernate.search.annotations.DocumentId;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.FieldBridge;
import org.hibernate.search.annotations.FullTextFilterDef;
import org.hibernate.search.annotations.FullTextFilterDefs;
import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.NumericField;
import org.hibernate.search.annotations.Resolution;
import org.hibernate.search.annotations.Store;
import org.hibernate.search.annotations.TokenFilterDef;
import org.hibernate.search.annotations.TokenizerDef;
import com.chenlb.mmseg4j.solr.MMSegTokenizerFactory;
import com.ctibook.booksystem.hibernatesearch.helper.LowerCaseStringBridge;
import com.ctibook.booksystem.hibernatesearch.helper.SubjectHeadingEmptyFilter;


/**
 * 书目
 * 
 * @author 鲁永刚
 * 
 */
@Indexed
@AnalyzerDef(name = "mmsegAnalyzer", // name
charFilters = { @CharFilterDef(factory = HTMLStripCharFilterFactory.class) }, // char过滤
tokenizer = @TokenizerDef(factory = MMSegTokenizerFactory.class), // 分词
filters = { @TokenFilterDef(factory = LowerCaseFilterFactory.class),// filters
		@TokenFilterDef(factory = StopFilterFactory.class) })
@FullTextFilterDefs({
	@FullTextFilterDef(name="subjectHeadingEmpty",impl=SubjectHeadingEmptyFilter.class)
})
@Analyzer(definition = "mmsegAnalyzer")
public class BookInfo {		
	/**
	 * id
	 */
	@DocumentId
	private String id;
	/**
	 * isbn 这个isbn需要格式化十三位
	 */
	@Field(index = Index.YES, analyze = Analyze.NO, store = Store.YES, boost = @Boost(4.0f))
	@FieldBridge(impl = LowerCaseStringBridge.class)
	private String isbn;	
	
	/**
	 * 副标题
	 */
	@Field(index = Index.YES, analyze = Analyze.YES, store = Store.YES, boost = @Boost(3.0f))
	private String subTitle;
	
	/**
	 * 题名
	 */
	@Field(index = Index.YES, analyze = Analyze.YES, store = Store.YES, boost = @Boost(3.0f))
	private String title;
	
	/**
	 * 中文题名
	 */
	@Field(index = Index.YES, analyze = Analyze.YES, store = Store.YES, boost = @Boost(2.0f))
	private String chineseTitle;
	
	/**
	 * 丛书名
	 */
	@Field(index = Index.YES, analyze = Analyze.YES, store = Store.YES, boost = @Boost(3.0f))
	private String seriesTitle;

	/**
	 * 出版社
	 */
	@Field(index = Index.YES, analyze = Analyze.NO, store = Store.YES)
	@FieldBridge(impl = LowerCaseStringBridge.class)
	private String publisherFullName;
	
	/**
	 * 出版社简称
	 */
	@Field(index = Index.YES, analyze = Analyze.NO, store = Store.YES)
	@FieldBridge(impl = LowerCaseStringBridge.class)
	private String publisherAlisName;

	/**
	 * 主题词
	 */
    @Field(index = Index.YES, analyze = Analyze.YES, store = Store.YES)
	@FieldBridge(impl = LowerCaseStringBridge.class)
	private String subjectHeadings;
 

	/**
	 * 作者
	 */
	@Field(index = Index.YES, analyze = Analyze.YES, store = Store.YES)
	private String author;

	/**
	 * 装帧
	 */
	@Field(index = Index.YES, analyze = Analyze.NO, store = Store.YES)
	@FieldBridge(impl = LowerCaseStringBridge.class)
	private String binding;
	
	/**
	 * 中图号
	 */
	@Field(index = Index.YES, analyze = Analyze.NO, store = Store.YES)
	@FieldBridge(impl = LowerCaseStringBridge.class)
	private String clcs;
	
	/**
	 * 版别
	 */
	@Field(index = Index.YES, analyze = Analyze.NO, store = Store.YES)
	@FieldBridge(impl = LowerCaseStringBridge.class)
	private String edition;
	

	/**
	 * 类别1
	 */
	@Field(index = Index.YES, analyze = Analyze.NO, store = Store.YES)
	@FieldBridge(impl = LowerCaseStringBridge.class)
	private String category1;
	
	/**
	 * 类别2
	 */
	@Field(index = Index.YES, analyze = Analyze.NO, store = Store.YES)
	@FieldBridge(impl = LowerCaseStringBridge.class)
	private String category2;
	/**
	 * 语种
	 */
	@Field(index = Index.YES, analyze = Analyze.NO, store = Store.YES)
	@FieldBridge(impl = LowerCaseStringBridge.class)
	private String language;
	/**
	 * 最后更新日期
	 */
	@Field(index = Index.YES, analyze = Analyze.NO, store = Store.YES, boost = @Boost(3.0f))
	private Date lastUpdateDate=new Date();
	/**
	 * 页数
	 */
	@Field(index = Index.YES, analyze = Analyze.NO, store = Store.YES)
	@NumericField()
	private Integer pageSize;
	/**
	 * 币制
	 */
	@Field(index = Index.YES, analyze = Analyze.NO, store = Store.YES)
	@FieldBridge(impl = LowerCaseStringBridge.class)
	private String currency;
	/**
	 * 价格
	 */
	@Field(index = Index.YES, analyze = Analyze.NO, store = Store.YES)
	@NumericField(precisionStep = 2)
	private Float price;
	
	/**
	 * 出版时间
	 */
	@Field(index=Index.YES,analyze=Analyze.NO,store=Store.YES)
	@DateBridge(resolution=Resolution.DAY)
	private Date pubDate;
	
	/**
	 * 出版年
	 */
	@Field(index=Index.YES,analyze=Analyze.NO,store=Store.YES)
	private Integer pubYear;
	/**
	 * 卷次
	 */
	@Field(index=Index.YES,analyze=Analyze.NO,store=Store.YES)
	private String volumn;
	
	@Field(index=Index.YES,analyze=Analyze.NO,store=Store.YES)
	private String createUserName;
	
	/**
	 * 开本/尺寸
	 */
	private String bookSize;
	
	/**
	 * 重量
	 */
	private String bookWeight;
	
	/**
	 * 描述
	 */
	@Field(index=Index.YES,analyze=Analyze.YES,store=Store.YES, boost = @Boost(2.0f))
	private String description;
	 
	

	/**
	 * 是否是黑名单
	 */
	@Field(index=Index.YES,analyze=Analyze.NO,store=Store.YES)
	private boolean isBlackBook;
	
	/**
	 * 中文主题词
	 */
	@Field(index = Index.YES, analyze = Analyze.YES, store = Store.YES)
	@FieldBridge(impl = LowerCaseStringBridge.class)
	private String chineseSubjectHeadings;

	/**
	 * 库存数量
	 */
	@Field(index = Index.YES, analyze = Analyze.NO, store = Store.YES)
	private int stockCount;


	public String getAuthor() {
		return author;
	}

	public String getBinding() {
		return binding;
	}
	
	public String getChineseTitle() {
		return chineseTitle;
	}	
	
	public String getCurrency() {
		return currency;
	}

	public String getEdition() {
		return edition;
	}

	public String getId() {
		return id;
	}

	public String getIsbn() {
		return isbn;
	}

	public String getLanguage() {
		return language;
	}

	public Date getLastUpdateDate() {
		return lastUpdateDate;
	}


	public Integer getPageSize() {
		return pageSize;
	}

	public Float getPrice() {
		return price;
	}

	public Date getPubDate() {
		
		return this.pubDate;
	}


	public String getSeriesTitle() {
		return seriesTitle;
	}

	public String getSubTitle() {
		return subTitle;
	}
	
	public String getTitle() {
		return title;
	}

	public String getVolumn() {
		return volumn;
	}
	
	public void setAuthor(String author) {
		this.author = author;
	}

	public void setBinding(String binding) {
		this.binding = binding;
	}


	public void setChineseTitle(String chineseTitle) {
		this.chineseTitle = chineseTitle;
	}

	public void setCurrency(String currency) {
		this.currency = currency;
	}

	public void setEdition(String edition) {
		this.edition = edition;
	}


	public void setId(String id) {
		this.id = id;
	}


	public void setIsbn(String isbn) {
		this.isbn = isbn;
	}

	public void setLanguage(String language) {
		this.language = language;
	}

	public void setLastUpdateDate(Date lastUpdateDate) {
		this.lastUpdateDate = lastUpdateDate;
	}

	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}

	public void setPrice(Float price) {
		this.price = price;
	}

	public void setPubDate(Date pubDate) {
		this.pubDate = pubDate;
	}

	public void setSeriesTitle(String seriesTitle) {
		this.seriesTitle = seriesTitle;
	}

	
	public void setSubTitle(String subTitle) {
		this.subTitle = subTitle;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public void setVolumn(String volumn) {
		this.volumn = volumn;
	}
		
	public String getCategory1() {
		return category1;
	}

	public void setCategory1(String category1) {
		this.category1 = category1;
	}

	public String getCategory2() {
		return category2;
	}

	public void setCategory2(String category2) {
		this.category2 = category2;
	}

	public String getPublisherAlisName() {
		return publisherAlisName;
	}

	public void setPublisherAlisName(String publisherAlisName) {
		this.publisherAlisName = publisherAlisName;
	}

	public String getBookWeight() {
		return bookWeight;
	}

	public void setBookWeight(String bookWeight) {
		this.bookWeight = bookWeight;
	}

	public String getBookSize() {
		return bookSize;
	}

	public void setBookSize(String bookSize) {
		this.bookSize = bookSize;
	}



		public String getSubjectHeadings() {
			return subjectHeadings;
		}

		public void setSubjectHeadings(String subjectHeadings) {
			this.subjectHeadings = subjectHeadings;
		}

		public String getPublisherFullName() {
			return publisherFullName;
		}

		public void setPublisherFullName(String publisherFullName) {
			this.publisherFullName = publisherFullName;
		}

		public String getClcs() {
			return clcs;
		}

		public void setClcs(String clcs) {
			this.clcs = clcs;
		}

		public String getCreateUserName() {
			return createUserName;
		}

		public void setCreateUserName(String createUserName) {
			this.createUserName = createUserName;
		}
		
		public String getChineseSubjectHeadings() {
			return chineseSubjectHeadings;
		}

		public void setChineseSubjectHeadings(String chineseSubjectHeadings) {
			this.chineseSubjectHeadings = chineseSubjectHeadings;
		}

		public boolean getIsBlackBook() {
			return isBlackBook;
		}

		public void setIsBlackBook(boolean isBlackBook) {
			this.isBlackBook = isBlackBook;
		}

		public int getStockCount() {
			return stockCount;
		}

		public void setStockCount(int stockCount) {
			this.stockCount = stockCount;
		}
		public String getDescription() {
			return description;
		}

		public void setDescription(String description) {
			this.description = description;
		}

		public Integer getPubYear() {
			return pubYear;
		}

		public void setPubYear(Integer pubYear) {
			this.pubYear = pubYear;
		}

}
